<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <style media="screen">
        body {
            background: transparent;
            height: 100%;
            position: absolute;
            /*opacity: 0;*/
        }

        .aui-mask {
            position: fixed;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            background: "#fff";
            opacity: 0;
            z-index: 8;
            visibility: hidden;
            -webkit-transition: opacity .3s, -webkit-transform .3s;
            transition: opacity .3s, transform .3s;
        }

        .aui-sharebox {
            width: 100%;
            position: fixed;
            bottom: 0;
            left: 0;
            z-index: 999;
            border-top-left-radius: 5px;
            border-top-right-radius: 5px;
            background-color: #ffffff;
            opacity: 0;
            -webkit-transition: opacity .3s, -webkit-transform .3s;
            transition: opacity .3s, transform .3s;
            -webkit-transform: translate3d(0, 100%, 0);
            transform: translate3d(0, 100%, 0);
        }
    </style>
</head>

<body onclick="closeF()">
    <div id="app"></div>
    <!-- <section class="aui-content-padded">
        <div class="aui-btn" tapmode onclick="openSharebox()">打开分享</div>
    </section>
    <section class="aui-content-padded">
        <p>点击了第<strong class="aui-text-danger" id="button-index"></strong>个按钮（buttonIndex）</p>
        <p>点击按钮的值为<strong class="aui-text-danger" id="button-value"></strong>(buttonValue)</p>
    </section> -->
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript" src="../../script/cling.js"></script>
<script type="text/javascript" src="../../script/aui-sharebox.js"></script>
<script type="text/javascript">
    apiready = function() {
        api.parseTapmode();
        vm.init();
        vm.openSharebox();

    }
    var vm = new Vue({
        el: "#app",
        data:{
          cvalue:''
        },
        methods: {
            init:function(){
              api.ajax({
                  url: cl.apiServer + 'cpssystemConfig/getCategoryList',
                  method: 'post',
                  headers: {
                      'Content-Type': 'application/json;charset=utf-8',
                      token:cl.userToken
                  },
                  data: {
                      body: {
                          type:14,
                          version:cl.deviceInfo().appVersion,
                          mobileInfo:cl.systemType()
                      }
                  }
              }, function(ret, err) {
                  console.log(JSON.stringify(ret));
                  if (ret) {
                      if (ret.code == 0) {
                        vm.cvalue = ret.data[0].cvalue;
                          // vm.dataList = ret.data;
                      }
                  }
              });
            },
            openSharebox: function() {
                var sharebox = new auiSharebox();
                sharebox.init({
                    frameBounces: true, //当前页面是否弹动，（主要针对安卓端）
                    buttons: [{
                        image: '../../image/copy.png',
                        text: '复制链接'
                    }],
                    col: 4,
                    cancelTitle: '取消' //可选,当然也可以采用下面的方式使用图标
                        // cancelTitle:'<i class="aui-iconfont aui-icon-close aui-font-size-16"></i>'//可选
                }, function(ret) {
                    if (ret) {
                        console.log(JSON.stringify(ret));
                        var clipBoard = api.require('clipBoard');
                        clipBoard.set({
                            value:vm.cvalue
                        }, function(ret, err) {
                            if (ret) {

                            }
                        });
                        cl.toast({
                            msg: '已复制到剪切板'
                        });
                        // document.getElementById("button-index").textContent = ret.buttonIndex;
                        // document.getElementById("button-value").textContent = ret.buttonValue;
                    }
                })
            }
        }

    })

    function closeF() {
        cl.closeFrame({
            name: '../main/share'
        });
    }
</script>

</html>
